<template>
	<view>
		
		<view class="order_list_wrap" v-if="Yirenzhenglist.length !=0">
			<view class="order_list_item" v-for="(item,index) in Yirenzhenglist" :key="index">
				<image class="right_top_icon" :src="BestImgUrl+'/Certification/image-4.png'" v-if="item.platform_type == 1"></image>
				<image class="right_top_icon" :src="BestImgUrl+'/Certification/image.png'" v-if="item.platform_type == 2"></image>
				<image class="right_top_icon" :src="BestImgUrl+'/Certification/image-2.png'" v-if="item.platform_type == 3"></image>
				<image class="right_top_icon" :src="BestImgUrl+'/Certification/image-3.png'" v-if="item.platform_type == 4"></image>
				<view class="goods_info u-flex">
					<view class="goods_img">
						<image :src="item.image"></image>
					</view>
					<view class="goods_name">
						<view>{{item.platform.platform_name}}</view>
						<view>账号：{{item.account}}</view>
						<view class="u-flex">粉丝数：{{item.fans}}<span>获赞数：{{item.likes}}</span></view>
					</view>
				</view>
				<view class="order_btnzu u-flex">
					<view class="right_zu u-flex">
						<view>解绑</view>
						<view @click="ToUp(item)">更新</view>
					</view>
				</view>
			</view>
		</view>
		<view v-else class="noneData">
			<u-empty text="暂无认证平台" mode="favor" icon-size="66"></u-empty>
		</view>
		
		<view class="bottom-border-btn-wrap" @click="addRenZheng()">
			<view class="bottom-fixed-btn">
				<view class="btn addrz">添加认证</view>
			</view>
		</view>
		
		<u-select v-model="Ptshow" value-name="platform_type" label-name="platform_name" :list="Ptlist" @confirm="Ptconfirm"></u-select>
		
	</view>
</template>

<script>
	const app = getApp();
	export default {
		data() {
			return {
				BestImgUrl: app.globalData.imgurl,
				userInfo: {},
				Yirenzhenglist: [],
				Ptshow: false,
				Ptlist: [],
				platformType: 0,
				platformData: {},
				LaiYuan: 0
			}
		},
		onLoad(ops) {
			let Details = JSON.parse(decodeURIComponent(ops.data));
			this.platformType = Details.platform_type
			this.platformData = Details
			console.log('某个平台数据', Details)
			
			let laiyuan = ops.LaiYuan
			if(laiyuan && laiyuan == 1){
				this.LaiYuan = laiyuan
			}
			
		},
		onShow() {
			this.getPingtaiList()
			this.myrenzhenglist()
		},
		methods: {
			GetUserInfo() {
				let that = this
				that.$api.GetuserInfo({
			
				}).then(res => {
					console.log('个人信息', res.data.result);
					this.userInfo = res.data.result
				}).catch(err => {})
			},
			myrenzhenglist(){
				let that = this
				that.$api.MyuserCertifiedlist({
					platform_type: 2
				}).then(res => {
					
					let datas = res.data.result
					
					//筛选出上个页面所选的平台列表
					let newArry = []
					datas.forEach(function(item, index) {
						if (item.platform_type == that.platformType) {
							newArry.push(item)
						}
					});
					that.Yirenzhenglist = res.data.result
					console.log('我的认证列表', res.data.result);
					
				}).catch(err => {})
			},
			getPingtaiList(){
				let that = this
				that.$api.userCertifiedplatform({
							
				}).then(res => {
					console.log('平台列表', res.data.result);
					that.Ptlist = res.data.result
				}).catch(err => {})
			},
			addRenZheng(){
				//this.Ptshow = true
				let ptData = {
					label: this.platformData.platform.platform_name,
					value: this.platformData.platform_type,
					screenshot_example: this.platformData.platform.screenshot_example,
					url_example: this.platformData.platform.url_example
				}
				uni.navigateTo({
					url: '/subpackageA/pages/Addapprove/Addapprove?data=' + encodeURIComponent(JSON.stringify(ptData))
				})
			},
			Ptconfirm(e){
				console.log(e)
				let ptData = {
					label: e[0].label,
					value: e[0].value,
					screenshot_example: this.platformData.platform.screenshot_example,
					url_example: this.platformData.platform.url_example
				}
				uni.navigateTo({
					url: '/subpackageA/pages/Addapprove/Addapprove?data=' + encodeURIComponent(JSON.stringify(ptData)) + '&LaiYuan=' + this.LaiYuan
				})
			},
			ToUp(data){
				let ptData = {
					label: data.platform.platform_name,
					value: data.platform.platform_type,
					screenshot_example: this.platformData.platform.screenshot_example,
					url_example: this.platformData.platform.url_example
				}
				uni.navigateTo({
					url: '/subpackageA/pages/Addapprove/Addapprove?data=' + encodeURIComponent(JSON.stringify(ptData)) + '&LaiYuan=' + this.LaiYuan
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f4f4f4;
	}
	.noneData {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.order_list_wrap {
		padding: 30rpx;
		.order_list_item {
			margin-bottom: 30rpx;
			border-radius: 24rpx;
			padding: 24rpx;
			background-color: #ffffff;
			position: relative;
			.right_top_icon {
				width: 68rpx;
				height: 68rpx;
				position: absolute;
				top: 20rpx;
				right: 20rpx;
			}
			.order_title {
				align-items: center;
				justify-content: space-between;
				.shop_title {
					align-items: center;
					image {
						width: 32rpx;
						height: 32rpx;
						margin-right: 6rpx;
					}
					text {
						color: $zzy-text-color-999999;
						font-size: 24rpx;
						-webkit-line-clamp: 1;
					}
				}
				.status {
					flex: 1;
					text-align: right;
					font-size: 24rpx;
					.color1 {
						color: #FF4E0D;
					}
					.color2 {
						color: #00AA3B;
					}
				}
			}
			.goods_info {
				align-items: flex-start;
				.goods_img {
					width: 96rpx;
					height: 96rpx;
					image {
						width: 96rpx;
						height: 96rpx;
						border-radius: 200rpx;
					}
				}
				.goods_name {
					padding-left: 16rpx;
					flex: 1;
					margin-bottom: 24rpx;
					view:nth-child(1){
						font-weight: bold;
						color: $zzy-text-color-333333;
						font-size: 30rpx;
					}
					view:nth-child(2){
						font-size: 26rpx;
						color: $zzy-text-color-666666;
						margin: 8rpx 0;
					}
					view:nth-child(3){
						align-items: center;
						font-size: 26rpx;
						color: $zzy-text-color-666666;
						flex: 1;
						span {
							margin-left: 10rpx;
						}
					}
				}
			}
			.bohui_yin {
				border-radius: 16rpx;
				padding: 20rpx;
				background-color: #FCF0ED;
				margin-bottom: 24rpx;
				view:nth-child(1){
					color: #FF4E0D;
				}
				view:nth-child(2){
					color: $zzy-text-color-666666;
				}
			}
			.order_btnzu {
				align-items: center;
				justify-content: flex-end;
				margin-top: 24rpx;
				.lxkf {
					flex: 1;
					align-items: center;
					color: $zzy-text-color-333333;
					font-size: 24rpx;
				}
				.right_zu {
					view:nth-child(1){
						border-radius: 200rpx;
						width: 144rpx;
						height: 56rpx;
						line-height: 56rpx;
						border: 1px solid #d9d9d9;
						color: #999999;
						text-align: center;
						font-size: 24rpx;
					}
					view:nth-child(2){
						background-color: #FF4E0D;
						border-radius: 200rpx;
						width: 144rpx;
						height: 56rpx;
						line-height: 56rpx;
						border: 1px solid #FF4E0D;
						color: #ffffff;
						text-align: center;
						font-size: 24rpx;
						margin-left: 20rpx;
					}
				}
			}
		}
	}
</style>
